Faithful surface: control-WebSocket exec + real checkpoint NDJSON API (v0.3.0) - #7
Merged
Merged
Conversation
Aligns exec and checkpoints with the real Sprites API surface
reverse-engineered from superfly/sprites-go (websocket.go, checkpoint.go).
Exec moves from JSON POST to a control WebSocket at GET
/v1/sprites/{id}/exec speaking the framed [streamID][payload] protocol
(StreamStdin=0, StreamStdout=1, StreamStderr=2, StreamExit=3,
StreamStdinEOF=4). The command is reconstructed from cmd/path query
params and run through the existing scripted interpreter; the server
writes stdout as [1], stderr as [2], then [3]<exitCodeByte> and closes.
The handshake advertises sprite-capabilities: control-ws.
Checkpoint create moves to the singular POST /v1/sprites/{id}/checkpoint
and streams NDJSON progress ending in {"event":"complete","id":"v<N>"}.
The list is now a bare JSON array of {id, comment, create_time, is_auto}
and a new GET .../checkpoints/{id} returns one checkpoint. Restore
streams NDJSON. Adds github.com/coder/websocket.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Aligns spritzer to the real Sprites API, reverse-engineered from
superfly/sprites-go(websocket.go, checkpoint.go) with a live-token smoke test. Supersedes the docs-based v0.2.0 guess.Exec is a control WebSocket
GET /v1/sprites/{name}/execupgrades to WS. Command via repeatedcmdquery params (+path). Non-PTY binary framing[StreamID][payload]: stdin=0, stdout=1, stderr=2, exit=3 (payload[0]=exit code), stdinEOF=4. Matches the SDK's wire protocol, so a chant WS client gets a real exit code (the compensation trigger).Real checkpoint API
POST /v1/sprites/{name}/checkpoint(singular){comment?}→ streaming NDJSON (info…complete {id:"v1"}). Plural POST is now 405, as real Sprites returns.GET .../checkpoints→ bare array[{id, comment, create_time, is_auto}].GET .../checkpoints/{id}; RestorePOST .../checkpoints/{id}/restore→ NDJSON.Verify
build/vet/gofmt/test/-race + golangci-lint v2.12.2 all green. Live smoke: WS
echo hi→ frames01 68 69 0a(stdout "hi\n") +03 00(exit 0);./risky.sh→02 …stderr +03 01(exit 1). Checkpoint loop: singular create NDJSON → array list → restore NDJSON.Cuts as v0.3.0. (
github.com/coder/websocketadded.)🤖 Generated with Claude Code